System and method of reconstructing complex custom objects

ABSTRACT

A system and method is provided for reconstructing one or more collections of objects across platforms. More particularly, Java Annotations are used to assist a Web Services Description Language (WSDL) wizard in reconstructing a collection of objects. In implementation, the system and method parses the object types such that a wizard can recreate or reconstruct the collection of objects for use by a receiving service. The method includes reconstructing a collection using one or more annotations that document a base object of the collection.

FIELD OF THE INVENTION

The invention generally relates to a system and method for computersystems and, more particularly, to a system and method forreconstructing complex objects across different platforms.

BACKGROUND OF THE INVENTION

Developers use collections and classes, like list, that are derived fromcollections to store, retrieve and manipulate data, and to transmit datafrom one method to another. The ability to iterate through collectionsand to generalize objects for reuse makes collections an excellentchoice in many JAVA applications. However, current WSDL wizards cannotdetermine what types of objects are placed into the collection. So, oncecompiled, the wizard is unable to determine what the base object was inthe collection. For this reason, the collection cannot be reconstructedby the wizard.

Rapid application development (RAD), JBOSS® and other developmentenvironments have not solved the problem of determining what was placedin the collection. (JBOSS is a registered trademark of Red Hat Inc. inthe United States and/or worldwide.) For example, in many cases, thedeveloper is placing the same object multiple times into the collection,which means that the collection contains objects derived from the sameclass. However, even in this case, the development environments cannotdetermine what was placed in the collection. In fact, known developmentenvironments can only reconstruct primitives.

RAD involves iterative development, and the construction of prototypes.Traditionally the rapid application development approach involvescompromises in usability, features, and/or execution speed. It isdescribed as a process through which the development cycle of anapplication is expedited. RAD thus enables quality products to bedeveloped faster, saving valuable resources. JBOSS is cross-platform,usable on any operating system that Java supports.

Accordingly, there exists a need in the art to overcome the deficienciesand limitations described hereinabove.

SUMMARY OF THE INVENTION

In a first aspect of the invention, a method comprises reconstructing acollection using one or more annotations that document a base object ofthe collection.

In another aspect of the invention, a method for reconstructing acollection comprises providing a computer infrastructure being operableto: check if an object of a collection is annotated; retrieve a baseclass documented by the annotation; retrieve a template; and wrap thebase class as an element in the template.

In another aspect of the invention, a computer program product forreconstructing a collection includes a computer readable media andfirst, second and third program instructions. The first programinstructions identifies an annotation documenting a base object. Thesecond program instructions retrieves the base object of the annotation,and the third program instructions reconstructs the collection using theannotation that documented the base object of the collection. The first,second and third program instructions are stored on the computerreadable media.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is described in the detailed description whichfollows, in reference to the noted plurality of drawings by way ofnon-limiting examples of exemplary embodiments of the present invention.

FIG. 1 shows an illustrative environment for implementing the invention;and

FIG. 2 shows a flow chart implementing processes in accordance withaspects of the invention.

DETAILED DESCRIPTION OF EMBODIMENTS OF THE INVENTION

The invention generally relates to a system and method forreconstructing one or more collections of objects across platforms. Moreparticularly, the present invention uses Java Annotations to assist aWeb Services Description Language (WSDL) wizard in reconstructing acollection of objects. In implementation, the system and method parsesthe object types such that a wizard can recreate or reconstruct thecollection of objects for use by a receiving service. In comparison,known systems and services cannot support the collection of complexobjects.

As should be understood by those of skill in the art, WSDL is anXML-based language that provides a model for describing web servicesover the Internet. A client program connecting to a web service can readthe primitives associated with the WSDL to determine what functions areavailable on the server. Also, a collection (sometimes called acontainer) is a complex object that groups multiple elements into asingle unit. Collections are used to store, retrieve and manipulatedata, and to transmit data from one method to another. Collectionstypically represent data items that form a natural group, like an order(a collection of order lines), a mail folder (a collection of messages),or a telephone directory (a collection of name/phone-number pairs). But,as the collection includes complex objects it is impossible for a wizardto reconstruct the collection in WSDL file. However, by using thepresent invention, the collection is now defined (annotated) so that awizard can reconstruct the WSDL file.

System Environment

FIG. 1 shows an illustrative environment 10 for managing the processesin accordance with the invention. To this extent, the environment 10includes a computer infrastructure 12 that can perform the processesdescribed herein. In particular, the computer infrastructure 12 includesa computing device 14 that comprises a wizard 30, which includes ProgramControl Logic to make the computing device 14 operable to perform theprocesses described herein. In embodiments, the wizard 30 is configuredto reconstruct a collection using annotations or labels which define thecontents (e.g., base objects or base class (which can be usedinterchangeably herein) of the collection.

In particular, the collection is annotated to define one or more baseobjects or classes thereby allowing the collection to be compatible withnon-java based web service consumers, in addition to the above notedfeatures. More fundamentally, the collection is provided withannotations or labels that define the contents (e.g., base classes orbase objects) of the collection. This allows the collection to bereadable outside the language, making it compatible with web serviceimplementations. For example, in implementation, the annotations orlabels are used by the wizard 30 to reconstruct the collection. This canbe done by retrieving the base class of the annotation, retrieving atemplate for the collection and wrapping the base class into thetemplate. In this way, the invention allows for the definitions ofcomplex, custom objects (e.g., a collection) to be transferable acrossmultiple platforms and automatically reconstructed by the wizard 30.

The computing device 14 includes a processor 20, a memory 22A, aninput/output (I/O) interface 24, and a bus 26. The memory 22A caninclude local memory employed during actual execution of program code(Program Control Logic), bulk storage, and cache memories which providetemporary storage of at least some program code in order to reduce thenumber of times code must be retrieved from bulk storage duringexecution. Further, the computing device 14 is in communication with anexternal I/O device/resource 28 and a storage system 22B. The I/O device28 can comprise any device that enables an individual to interact withthe computing device 14 or any device that enables the computing device14 to communicate with one or more other computing devices using anytype of communications link. For example, the external I/Odevice/resource 28 may be keyboards, displays, pointing devices, etc. Inaccordance with the present invention, a programmer or designer canannotate the collection using the external I/O device/resource 28. Astorage “S” may also be provided internally to the computing device 14.

In general, the processor 20 executes the Program Control Logic, whichcan be stored in memory 22A and/or storage system 22B or the wizard 30.While executing the Program Control Logic, the processor 20 can readand/or write data to/from memory 22A, storage system 22B, the wizard 30,and/or I/O interface 24. The bus 26 provides a communications linkbetween each of the components in the computing device 14.

The computing device 14 can comprise any general purpose computingarticle of manufacture capable of executing computer program codeinstalled thereon (e.g., a personal computer, server, etc.). However, itis understood that the computing device 14 is only representative ofvarious possible equivalent-computing devices that may perform theprocesses described herein. To this extent, in embodiments, thefunctionality provided by computing device 14 can be implemented by acomputing article of manufacture that includes any combination ofgeneral and/or specific purpose hardware and/or computer program code,as discussed in more detail below. In each embodiment, the ProgramControl Logic and hardware can be created using standard programming andengineering techniques, respectively.

Similarly, the computer infrastructure 12 is only illustrative ofvarious types of computer infrastructures for implementing theinvention. For example, in embodiments, the computer infrastructure 12comprises two or more computing devices (e.g., a server cluster) thatcommunicate over any type of communications link, such as a network, ashared memory, or the like, to perform the process described herein.Further, while performing the processes described herein, one or morecomputing devices in the computer infrastructure 12 can communicate withone or more other computing devices external to computer infrastructure12 using any type of communications link. The communications link cancomprise any combination of wired and/or wireless links; any combinationof one or more types of networks (e.g., the Internet, a wide areanetwork, a local area network, a virtual private network, etc.); and/orutilize any combination of transmission techniques and protocols.

In one example, a programmer can annotate the collection of complexobjects using a first computer infrastructure. The annotation can beused to define base classes or base objects in the collection. Thecollection can then be transmitted to a receiving computerinfrastructure, where a wizard 30 on the receiving computerinfrastructure reconstructs the WSDL file in XML. As noted herein, thisis done by retrieving a base class (base object) as defined by theannotation, retrieving a template for the collection and wrapping thebase class as an element in the template.

Exemplary Implementation

Normally, when a collection is created, the base class (object) in thecollection is not known by the compiler and the WSDL generator. However,by implementing the present invention, the collection is defined in sucha way that the base class (object) of the collection is known by thecompiler and the WSDL generator. In its simplest form, the contents ofthe collection are labeled (annotated). This label allows the WSDLwizard to reconstruct the collection, as it now can determine thecontents of the collection.

In one embodiment, to provide the advantages herein, Java annotationsare used to document (define) the base object(s) used by the collection.For example, an exemplary annotation can be written as follows:

@Documented public @interface BaseObject { String determineBase( ); }

This annotation will generate a javaDoc reference that shows the baseobject being added to the collection. As in the case of a collection,the service provider would know that the base element (object) of thecollection would be MyMessageDTO class.

-   -   @BaseObject(“MyMessageDTO”) Collection mycollection=List( );

In one embodiment, the MyMessageDTO is as follows:

Public class MyMessageDTO( ){ Private String Message; Private StringMessageType; ...

The invention would break the collection into a group of complex types(base classes, base objects or other primitives) using the annotation todecompose the collection to the base objects that are placed into thecollection. For example, the base object can be shown in the WDSL asfollows:

<xsd:complexType name=“MyMessageDTO”> <xsd:all> <xsd:elementname=“message” type=“xsd:string”/> <xsd:element name=“messagetype”type=“xsd:string”/> </xsd:all> </xsd:complexType> .....

Now that the base object is shown in the WSDL it is possible to use anxml plug-in to instruct the wizard how to handle the collection. Thiscan be written, for example, as follows:

<type name=”collection”> <array> </object> </array> </type>

Additionally or alternatively, a hash, map or list can be used by thewizard. A hash, for example, can be defined as:

<type name=”hash”> <array> </hashobject> </array> </type> <typename=”hashobject”> </string> </object> </type>

In this manner, a complex object can be converted to a simpler object(e.g., into its primitives). In this example, a collection ofMyMessageDTO's would be written as:

<complexType name=“CollectionMymessageDTO”> <complexContent><restriction base=“soapenc:Array”> <attribute ref=“soapenc:arrayType”wsdl:arrayType=“tns:MyMessageDTO[ ]”/> </restriction> </complexContent>

Notice that the word “collection” defines the complex type. When aclient (wizard) that implements collections is used, it can parse thename and determine that it is using an object type that can betranscoded back into its base object.

Also, in order for transcoding to work properly, the WSDL element namesare preferably a name of an attribute in the class. This becomesimportant when the tool creates objects like hash maps where there is akey/value relationship.

Exemplary Processes in Accordance with the Invention

FIG. 2 is a flow diagram showing processing steps of embodiments of theinvention. FIG. 2 may equally represent a high-level block diagram ofcomponents of the invention implementing the steps thereof. The steps ofFIG. 2 may be implemented on computer program code in combination withthe appropriate hardware. This computer program code (Program ControlLogic) may be stored on storage media such as a diskette, hard disk,CD-ROM, DVD-ROM or tape, as well as a memory storage device orcollection of memory storage devices such as read-only memory (ROM) orrandom access memory (RAM) shown in FIG. 1. Additionally, the computerprogram code can be transferred to a workstation over the Internet orsome other type of network.

The invention can take the form of hardware and software elements asshown in FIG. 1, e.g., computer infrastructure. The software elementsmay be firmware, resident software, microcode, etc. Furthermore, theinvention can take the form of a computer program product accessiblefrom a computer-usable or computer-readable medium providing programcode for use by or in connection with a computer or any instructionexecution system. For the purposes of this description, acomputer-usable or computer readable medium can be any apparatus thatcan contain, store, communicate, propagate, or transport the program foruse by or in connection with the instruction execution system,apparatus, or device. The medium can be an electronic, magnetic,optical, electromagnetic, infrared, or semiconductor system (orapparatus or device) or a propagation medium. Examples of acomputer-readable medium include a semiconductor or solid state memory,magnetic tape, a removable computer diskette, a random access memory(RAM), a read-only memory (ROM), a rigid magnetic disk and an opticaldisk. Current examples of optical disks include compact disk-read onlymemory (CD-ROM), compact disk-read/write (CD-R/W) and DVD.

In embodiments, a service provider, such as a Solution Integrator, couldoffer to perform the processes described herein. In this case, theservice provider can create, maintain, deploy, support, etc., thecomputer infrastructure that performs the process steps of the inventionfor one or more customers. In return, the service provider can receivepayment from the customer(s) under a subscription and/or fee agreement.

Referring to FIG. 2, at step 200, the wizard begins the construction ofa WSDL file. At step 205, the wizard parses code for the objects thatare output for the XML. At step 210, a determination is made as towhether the object(s) is a primitive. If the object(s) is a primitive,at step 215, the wizard writes the XML using the primitive. If theobject(s) is not a primitive, at step 220, the parser checks if theobject(s) is annotated. At step 225, a determination is made as towhether the object is annotated, e.g., identifies an annotation. If theobject is not annotated, at step 230, the wizard creates an exception,e.g., does not reconstruct the collection.

If the object is annotated, at step 235, the wizard retrieves the baseclass (base object) of the annotation. The wizard retrieves the templatefor the collection, map, hash or library, at step 240. At step 245, thewizard wraps the base class (base object) as an element in the template.In this manner, the wizard can now reconstruct the collection in an XML.

Thus, as should now be understood by those of skill in the art, thewizard is configured to reconstruct the collection of complex objectsfrom its basic structure (which is understandable by the WSDL). That is,once the collection of complex objects is decomposed into as simpletypes as possible, e.g., primitives, the wizard can reconstruct thecollection using a label (which defines the contents of the collection).For example, once the collection is broken into its primitives, thewizard can reconstruct the WSDL on a receiving computing device using atemplate for the collection. By breaking down the collection into itsprimitives, the service consumer and the service provider can now bothunderstand what will be returned by the WSDL file, even though it is acollection of complex objects. In this manner, a collection of complexobjects can be broken down into their simplest form to allow a standardinteraction between a consumer and service provider, effectuating atransaction that would not have otherwise been possible using a wizard.

While the invention has been described in terms of embodiments, thoseskilled in the art will recognize that the invention can be practicedwith modifications and in the spirit and scope of the appended claims.

What is claimed is:
 1. A computer program product for reconstructing acollection, the computer program product comprising: a non-transitorycomputer readable storage medium having stored thereon: programinstructions to decompose a collection of complex objects into one ormore base objects using one or more annotations that document the one ormore base objects that are placed in the collection, wherein thedecomposing comprises: parsing code for one or more objects; determiningthat the parsed one or more objects is not a primitive, and determiningwhether the one or more objects is annotated, wherein when the one ormore objects is annotated and the annotations are Java annotations, theJava annotations: define the one or more base objects used by thecollection; generate a javaDoc reference that shows the one or more baseobjects being added to the collection; and break the collection into agroup of complex object types and decompose the collection to the one ormore base objects that are placed in the collection; and when the one ormore objects is not annotated, generating an exception that does notreconstruct the collection.
 2. The computer program product of claim 1,further comprising program instructions to automatically reconstruct thedefinitions of the complex objects within the collection using a wizardwhen the one or more objects is annotated, wherein the wizard uses anXML plug-in to determine how to handle the collection.
 3. The computerprogram product of claim 2, wherein the reconstructing using the wizardcomprises: retrieving the one or more base objects for the collectionusing the one or more annotations determined from the one or moreobjects of the collection; retrieving a template for reconstructing thecollection as an XML using the retrieved one or more base objects forthe collection; and reconstructing the collection by wrapping theretrieved one or more base objects as elements in the retrievedtemplate.
 4. The computer program product of claim 3, wherein thetemplate is retrieved for a hash, map or library, which documents theone or more base object.
 5. The computer program product of claim 3,wherein the wizard uses the template comprising a hash, map, or list toconvert a complex object into a simpler object.
 6. The computer programproduct of claim 1, wherein when the one or more objects is theprimitive, reconstructing an XML using the primitive.
 7. The computerprogram product of claim 1, wherein the collection is annotated todefine the one or more base objects, wherein: the collection iscompatible with non-Java based web service consumers and web serviceimplementations; and definitions of complex, custom objects aretransferable across multiple platforms and automatically reconstructedby a wizard.
 8. The computer program product of claim 1, wherein WebServices Description Language (WSDL) element names are a name of anattribute in the one or more base objects and define a relationshipbetween the collection of the complex objects and the one or more baseobjects.
 9. The computer program product of claim 1, wherein thecollection is a collection of classes which include a name, a complexcontext, a restriction base, and an attribute reference.
 10. Thecomputer program product of claim 1, further comprising determining thatthe primitive objects is the primitive, and performing writing of a WebServices Description Language (WDSL) file using the primitive.
 11. Amethod implemented in a computer infrastructure having computerexecutable code tangibly embodied on a non-transitory computer readablestorage medium having programming instructions configured to: decomposea collection of complex objects into one or more base objects using oneor more annotations that document the one or more base objects, whereinthe decomposing comprises: parsing code for one or more objects; whenthe one or more objects is the primitive, writing the collection usingthe primitive; and when the one or more objects is not the primitive,determine whether the one or more objects is annotated, wherein theannotations are Java annotations, which: define the one or more baseobjects used by the collection; generate a javaDoc reference that showsthe one or more base objects being added to the collection; and breakthe collection into a group of complex object types and decompose thecollection to the one or more base objects that are placed in thecollection; and when the one or more objects is not annotated generatean exception that does not reconstruct the collection.